package com.wyd.common.component;

import lombok.Getter;
import lombok.Setter;

/**
 * 带信息的异常
 */
@Getter
@Setter
public class InfoException extends RuntimeException {
    private String code;
    private Object data;

    public InfoException(String code, String message, Object data) {
        super(message);
        this.code = code;
        this.data = data;
    }

    public static InfoException i(String code, String message, Object data) {
        return new InfoException(code, message, data);
    }

    public static InfoException i(String code, String message) {
        return new InfoException(code, message, null);
    }
}
